package com.certapp.dao.mapper;

import com.certapp.dao.entity.TbCertConfig;
import com.certapp.dao.entity.TbCertConfigExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbCertConfigMapper {

    @Update({"update tb_cert_config", "set pic_preview = #{picPreview,jdbcType=LONGVARCHAR}",
            "where id = #{id,jdbcType=INTEGER}"})
    int updatePicById(@Param("id") Integer id, @Param("picPreview") String picPreview);

    @Select({"select",
            "id, cert_name, filed_font, qr_code_url, qr_code_local, number_local, num_font, ",
            "cert_desc, create_time, modify_time, cert_real, base_map, pic_preview",
            "from tb_cert_config", "where cert_name = #{certName,jdbcType=VARCHAR}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "cert_name", property = "certName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "filed_font", property = "filedFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_url", property = "qrCodeUrl", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_local", property = "qrCodeLocal",
                    jdbcType = JdbcType.VARCHAR),
            @Result(column = "number_local", property = "numberLocal", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_font", property = "numFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "cert_desc", property = "certDesc", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cert_real", property = "certReal", jdbcType = JdbcType.INTEGER),
            @Result(column = "base_map", property = "baseMap", jdbcType = JdbcType.LONGVARCHAR),
            @Result(column = "pic_preview", property = "picPreview",
                    jdbcType = JdbcType.LONGVARCHAR)})
    List<TbCertConfig> selectByCertName(@Param("certName") String certName);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCertConfigSqlProvider.class, method = "countByExample")
    long countByExample(TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbCertConfigSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Delete({"delete from tb_cert_config", "where id = #{id,jdbcType=INTEGER}"})
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Insert({"insert into tb_cert_config (cert_name, filed_font, ", "qr_code_url, qr_code_local, ",
            "number_local, num_font, ", "cert_desc, create_time, ", "modify_time, cert_real, ",
            "base_map, pic_preview)",
            "values (#{certName,jdbcType=VARCHAR}, #{filedFont,jdbcType=VARCHAR}, ",
            "#{qrCodeUrl,jdbcType=VARCHAR}, #{qrCodeLocal,jdbcType=VARCHAR}, ",
            "#{numberLocal,jdbcType=VARCHAR}, #{numFont,jdbcType=VARCHAR}, ",
            "#{certDesc,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
            "#{modifyTime,jdbcType=TIMESTAMP}, #{certReal,jdbcType=INTEGER}, ",
            "#{baseMap,jdbcType=LONGVARCHAR}, #{picPreview,jdbcType=LONGVARCHAR})"})
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false,
            resultType = Integer.class)
    int insert(TbCertConfig record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbCertConfigSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false,
            resultType = Integer.class)
    int insertSelective(TbCertConfig record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCertConfigSqlProvider.class, method = "selectByExampleWithBLOBs")
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "cert_name", property = "certName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "filed_font", property = "filedFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_url", property = "qrCodeUrl", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_local", property = "qrCodeLocal",
                    jdbcType = JdbcType.VARCHAR),
            @Result(column = "number_local", property = "numberLocal", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_font", property = "numFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "cert_desc", property = "certDesc", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cert_real", property = "certReal", jdbcType = JdbcType.INTEGER),
            @Result(column = "base_map", property = "baseMap", jdbcType = JdbcType.LONGVARCHAR),
            @Result(column = "pic_preview", property = "picPreview",
                    jdbcType = JdbcType.LONGVARCHAR)})
    List<TbCertConfig> selectByExampleWithBLOBs(TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCertConfigSqlProvider.class, method = "selectByExample")
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "cert_name", property = "certName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "filed_font", property = "filedFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_url", property = "qrCodeUrl", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_local", property = "qrCodeLocal",
                    jdbcType = JdbcType.VARCHAR),
            @Result(column = "number_local", property = "numberLocal", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_font", property = "numFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "cert_desc", property = "certDesc", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cert_real", property = "certReal", jdbcType = JdbcType.INTEGER)})
    List<TbCertConfig> selectByExample(TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Select({"select",
            "id, cert_name, filed_font, qr_code_url, qr_code_local, number_local, num_font, ",
            "cert_desc, create_time, modify_time, cert_real, base_map, pic_preview",
            "from tb_cert_config", "where id = #{id,jdbcType=INTEGER}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "cert_name", property = "certName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "filed_font", property = "filedFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_url", property = "qrCodeUrl", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_local", property = "qrCodeLocal",
                    jdbcType = JdbcType.VARCHAR),
            @Result(column = "number_local", property = "numberLocal", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_font", property = "numFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "cert_desc", property = "certDesc", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cert_real", property = "certReal", jdbcType = JdbcType.INTEGER),
            @Result(column = "base_map", property = "baseMap", jdbcType = JdbcType.LONGVARCHAR),
            @Result(column = "pic_preview", property = "picPreview",
                    jdbcType = JdbcType.LONGVARCHAR)})
    TbCertConfig selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCertConfigSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbCertConfig record,
            @Param("example") TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCertConfigSqlProvider.class, method = "updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") TbCertConfig record,
            @Param("example") TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCertConfigSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbCertConfig record,
            @Param("example") TbCertConfigExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCertConfigSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbCertConfig record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Update({"update tb_cert_config", "set cert_name = #{certName,jdbcType=VARCHAR},",
            "filed_font = #{filedFont,jdbcType=VARCHAR},",
            "qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR},",
            "qr_code_local = #{qrCodeLocal,jdbcType=VARCHAR},",
            "number_local = #{numberLocal,jdbcType=VARCHAR},",
            "num_font = #{numFont,jdbcType=VARCHAR},", "cert_desc = #{certDesc,jdbcType=VARCHAR},",
            "create_time = #{createTime,jdbcType=TIMESTAMP},",
            "modify_time = #{modifyTime,jdbcType=TIMESTAMP},",
            "cert_real = #{certReal,jdbcType=INTEGER},",
            "base_map = #{baseMap,jdbcType=LONGVARCHAR},",
            "pic_preview = #{picPreview,jdbcType=LONGVARCHAR}",
            "where id = #{id,jdbcType=INTEGER}"})
    int updateByPrimaryKeyWithBLOBs(TbCertConfig record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Update({"update tb_cert_config", "set cert_name = #{certName,jdbcType=VARCHAR},",
            "filed_font = #{filedFont,jdbcType=VARCHAR},",
            "qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR},",
            "qr_code_local = #{qrCodeLocal,jdbcType=VARCHAR},",
            "number_local = #{numberLocal,jdbcType=VARCHAR},",
            "num_font = #{numFont,jdbcType=VARCHAR},", "cert_desc = #{certDesc,jdbcType=VARCHAR},",
            "create_time = #{createTime,jdbcType=TIMESTAMP},",
            "modify_time = #{modifyTime,jdbcType=TIMESTAMP},",
            "base_map = #{baseMap,jdbcType=LONGVARCHAR},",
            "cert_real = #{certReal,jdbcType=INTEGER}", "where id = #{id,jdbcType=INTEGER}"})
    int updateByPrimaryKey(TbCertConfig record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({"<script>", "insert into tb_cert_config (cert_name, ", "filed_font, qr_code_url, ",
            "qr_code_local, number_local, ", "num_font, cert_desc, ", "create_time, modify_time, ",
            "cert_real, base_map, ", "pic_preview)",
            "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.certName,jdbcType=VARCHAR}, ",
            "#{detail.filedFont,jdbcType=VARCHAR}, #{detail.qrCodeUrl,jdbcType=VARCHAR}, ",
            "#{detail.qrCodeLocal,jdbcType=VARCHAR}, #{detail.numberLocal,jdbcType=VARCHAR}, ",
            "#{detail.numFont,jdbcType=VARCHAR}, #{detail.certDesc,jdbcType=VARCHAR}, ",
            "#{detail.createTime,jdbcType=TIMESTAMP}, #{detail.modifyTime,jdbcType=TIMESTAMP}, ",
            "#{detail.certReal,jdbcType=INTEGER}, #{detail.baseMap,jdbcType=LONGVARCHAR}, ",
            "#{detail.picPreview,jdbcType=LONGVARCHAR})</foreach></script>"})
    int batchInsert(List<TbCertConfig> list);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table
     * tb_cert_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCertConfigSqlProvider.class, method = "getOneByExample")
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "cert_name", property = "certName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "filed_font", property = "filedFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_url", property = "qrCodeUrl", jdbcType = JdbcType.VARCHAR),
            @Result(column = "qr_code_local", property = "qrCodeLocal",
                    jdbcType = JdbcType.VARCHAR),
            @Result(column = "number_local", property = "numberLocal", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_font", property = "numFont", jdbcType = JdbcType.VARCHAR),
            @Result(column = "cert_desc", property = "certDesc", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cert_real", property = "certReal", jdbcType = JdbcType.INTEGER),
            @Result(column = "base_map", property = "baseMap", jdbcType = JdbcType.LONGVARCHAR),
            @Result(column = "pic_preview", property = "picPreview",
                    jdbcType = JdbcType.LONGVARCHAR)})
    Optional<TbCertConfig> getOneByExample(TbCertConfigExample example);
}
